package cn.iocoder.yudao.module.product.enums.spu;

import cn.iocoder.yudao.framework.common.core.IntArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 自定义用户输入框
 *
 * @author lizhongwen
 */
@Getter
@AllArgsConstructor
public enum CustomUserInputEnum implements IntArrayValuable {
    RECHARGE_ACCOUNT(1, "充值账号"),
    RECHARGE_PASSWORD(2, "充值密码"),
    RECHARGE_GAME(3, "充值游戏"),
    RECHARGE_REGION(4, "充值区"),
    RECHARGE_SERVER(5, "充值服"),
    BILLING_METHOD(6, "计费方式"),
    GAME_CHARACTER(7, "游戏角色"),
    CONTACT_PHONE(8, "联系电话"),
    CONTACT_QQ(9, "联系QQ"),
    RECEIVE_EMAIL(10, "接收邮箱");

    /**
     * 值
     */
    private final int value;

    /**
     * 描述
     */
    private final String desc;

    public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(CustomUserInputEnum::getValue).toArray();

    @Override
    public int[] array() {
        return ARRAYS;
    }

    public CustomUserInputEnum fromValue(int value) {
        for (CustomUserInputEnum item : values()) {
            if (item.value == value) {
                return item;
            }
        }
        throw new IllegalArgumentException("枚举类型 CustomUserInputEnum 不支持整型值：" + value);
    }

}
